#include <iostream>
#define MAX 10
using namespace std;

int arr1[MAX*2];
int arr2[MAX];

int main(){
	int i;
	int j;
	int x;
	
	for ( i = 0; i < MAX; i++ ){
		arr1[i] = 2*i + 1;
		arr2[i] = i*i; 
		printf("\n%d\t%d", arr1[i], arr2[i]);
	}
	
	i = MAX -1;
	j = MAX -1;
	x = 2*MAX - 1;
	
	while ( i >= 0 && j >= 0){
		if(arr2[i] > arr1[j]){
			arr1[x--] = arr2[i--];
		}else{
			arr1[x--] = arr1[j--];
		}
	}
	
	while ( i >=0 )
		arr1[x--] = arr2[i--];
	
	printf("\n");
	for (i=0;i<(2*MAX);i++){
		printf("%d ", arr1[i]);
	}
	return 0;	
}